package pe.sonrisas.tools.dao;

import java.util.Properties;
import pe.sonrisas.tools.exception.SonrisasException;


public abstract class FactoryDAO {
//	public abstract CategoriaDAO getCategoriaDAO();
//	public abstract ProductoDAO getProductoDAO();
        public abstract PersonaDAO getPersonaDAO();	
        public abstract PacienteDAO getPacienteDAO();
        public abstract OdontologoDAO getOdontologoDAO();
        public abstract ReservaDAO getReservaDAO();
        public abstract UbigeoDAO getUbigeoDAO();
        public abstract TratamientoDAO getTratamientoDAO();
        public abstract HorarioOdontologoDAO getHorarioOdontologoDAO();
        public abstract FotoPacienteDAO getFotoPacienteDAO();
        public abstract DienteDAO getDienteDAO();
        public abstract MotivoDAO getMotivoDAO();
        public abstract ItemDAO getItemDAO();
        public abstract ModuloDAO getModuloDAO();
        
    
	public static FactoryDAO getFactoryDAO() throws SonrisasException{
		FactoryDAO factoryDAO = null;	
		try{
			Properties prop = new Properties();
			prop.load(FactoryDAO.class.getResourceAsStream("factory.properties"));
			//Reflection
			factoryDAO = (FactoryDAO)Class.forName
												(prop.getProperty("dao")).newInstance();			
		}catch(Exception ex){
			//ex.getMessage() esto registrarlo usando Logging
			throw new SonrisasException("FactoryDAO: No se pudo ejecutar");
		}		
		return factoryDAO;
	}
}
